home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vampire's Kiss
/
Vampire's Kiss.iso
/
pc
/
vampire.rul
< prev
next >
Wrap
Text File
|
1994-09-30
|
18KB
|
559 lines
//
// Vampire's Kiss v1.5 CD Installation Script
// by Terry R. Schussler
// (c) 1994 by gray matter design. All rights reserved.
//
// Notes: Requires ~500K of hard disk space to install
//
/*--------------------------------------------------------*/
/* Constant Declarations */
/*--------------------------------------------------------*/
#define STD_MAX_SIZE 500
#define LARGE_STRING 5000
#define TOTAL_HD_FILE_SIZE 2000000
#define TOTAL_CD_FILE_SIZE 1000000
#define ALT_FILE_SIZE 50000
#define BASE_FILE_SIZE 125000
/*--------------------------------------------------------*/
/* Variable Declarations */
/*--------------------------------------------------------*/
declare
string szText[ LARGE_STRING ], szDefPath[ STD_MAX_SIZE ];
string szResultPath[ STD_MAX_SIZE ];
string szDisk[ 50 ], szFileName[ STD_MAX_SIZE ];
string szBitmapPath[ STD_MAX_SIZE ];
string szErrMsg [ STD_MAX_SIZE ];
string szErrFile [ STD_MAX_SIZE ];
string szREADME [ STD_MAX_SIZE ];
string szDir[ STD_MAX_SIZE ];
string szQTWPath[ STD_MAX_SIZE ];
string szPath[ STD_MAX_SIZE ];
string szIconPath[ STD_MAX_SIZE ];
string szBMPPath[ STD_MAX_SIZE ];
string szProgramPath[ STD_MAX_SIZE ];
string szDrive[ STD_MAX_SIZE ];
string szText2[ LARGE_STRING ];
string szResult[ LARGE_STRING ];
string szWorkingDir[ STD_MAX_SIZE ];
string szA[ STD_MAX_SIZE ];
string szB[ STD_MAX_SIZE ];
string szC[ STD_MAX_SIZE ];
string szD[ STD_MAX_SIZE ];
string szE[ STD_MAX_SIZE ];
string szF[ STD_MAX_SIZE ];
string gWinCDDrive[ 5 ];
string gWinInstallLoc[ 5 ];
number gWinProcessor;
number nHDSpaceRequired;
number nCDSpaceRequired;
number nFileHandle;
number nNumber;
number nResult;
number nCDROM;
number nHARDDISK;
number nDx;
number nDy;
number nvD;
number nvF;
number QTWlist;
program /* Must use program keyword to start the statements */
Start:
Enable( DEFWINDOWMODE );
Handler( EXIT, HandleExit );
// Set the color of the back to be BLACK
//SetColor( BACKGROUND, RGB(0,0,0) ); default is BLACK
SetColor( STATUSBAR, RGB(255,0,0) );
SetFont( FONT_TITLE, STYLE_BOLD, "Helv" );
SetTitle( "Vampire's Kiss INSTALLER", 45, BACKGROUNDCAPTION );
SetStatusWindow( 0, "Beginning installation process..." );
// Enable various objects.
//Enable( BITMAPFADE ); // All bitmaps will fade into the screen.
PlaceWindow( EXIT, 10, 10, LOWER_RIGHT );
Enable( EXIT ); // Exit Button
PlaceWindow( STATUS, 0, 0, UPPER_LEFT );
Enable( STATUS ); // Status, % Complete Bar Window
GetExtents( nDx, nDy ); // how big is the screen
nDx = nDx - 100;
nDy = nDy - 340;
SizeWindow( INFO, nDx, nDy );
PlaceWindow( INFO, 0, 0, LOWER_LEFT );
Enable( INFO ); // Info Windows
Enable( BITMAP256COLORS ); // 256 color display
Enable( INDVFILESTATUS ); // filename display
GetExtents( nDx, nDy ); // how big is the screen
SizeWindow( BACKGROUND, nDx, nDy );
PlaceWindow( BACKGROUND, 0, 0, UPPER_LEFT );
Enable( BACKGROUND ); // Display background and all windows
// In Info Window to display the .lis information
SetInfoWindow( "Vampire's Kiss Installer Information", "vampire.LIS" );
// Determine target location for hard disk files
GetDisk( TARGETDIR, szDisk );
szDefPath = SRCDIR;
nHDSpaceRequired = TOTAL_HD_FILE_SIZE;
nCDSpaceRequired = TOTAL_CD_FILE_SIZE;
DrawBitmaps:
// Place logo on the screen
StrCopy( szBMPPath, SRCDIR );
AppendToPath( szBMPPath, "vampire.BMP" );
PlaceBitmap( szBMPPath, 101, 0, 0, UPPER_LEFT );
Disable( BITMAPFADE ); // Bitmaps will now be drawn and not faded in
TargetLoc:
SetStatusWindow( 0, "Installing Vampire's Kiss..." );
BeginInstall:
GetDisk( TARGETDIR, szDisk );
CheckDiskSpace:
// Check to see if enough space is free on the destination.
// GetDiskSpace returns free space in LAST_RESULT.
GetDiskSpace( szDisk );
if LAST_RESULT > nCDSpaceRequired goto EnoughSpace;
szText = "There is not enough space on drive " + szDisk +
"\nto install Vampire's Kiss as requested.";
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;
EnoughSpace:
call TestTargetDrive;
call QuickTimeInstall;
//call FileTransfer;
//call FontInstall;
//call PrefsMaker;
call finishInstall;
endInstall:
SetDialogTitle( DLG_MSG_INFORMATION, "Successful Installation!" );
szText = "Vampire's Kiss has just been successfully installed. " +
" Don't forget to read the ReadMe file for last minute information!";
MessageBeep( 0 );
MessageBox( szText, INFORMATION ); // Get the user to acknowledge success
ShowGroup( "Digital Playground", SW_NORMAL );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
szText = "Click YES to restart your computer to complete installation." +
" If your computer fails to reboot, you may need to turn" +
" it off and on again to reboot.";
AskYesNo(szText, YES);
if LAST_RESULT = YES then
System( SYS_BOOTMACHINE );
exit; //Exit installation program.
else
szText = "Warning: You will need to reboot to have Vampire's Kiss installed.";
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "Reboot Reminder!" );
MessageBox( szText, WARNING );
exit;
endif;
//-----------------------------------------------------------------------------
//
// Name: DirExists
//
// Descrip: This procedure ensures the CD is still in the drive.
//
// Params:
//
//-----------------------------------------------------------------------------
DirExists:
SetStatusWindow( 0, "Continuing installation..." );
StrCopy( TARGETDIR, szResultPath );
// Check to see if INSTALL.INS exists on the CD
// If it does, then it must the right disk.
StrCopy( szText, SRCDIR );
AppendToPath( szText, "SETUP.INS" );
GetFileInfo( szText, FILE_DATE, nNumber, szText2 );
if LAST_RESULT != FALSE then
// Ask user to enter a disk in drive.
szText = "Please insert the Vampire's Kiss CD...";
SetDialogTitle( DLG_ENTER_DISK, "CD-ROM Disc Request" );
EnterDisk( szText, "setup.ins");
if LAST_RESULT != TRUE then
call ConfirmCancel; // Call to confirm cancel
goto DirExists; // returned, therefore continue
endif;
endif;
return;
//-----------------------------------------------------------------------------
//
// Name: TestTargetDrive
//
// Descrip: This will make sure the boot drive is writable
//
// Params:
//
//-----------------------------------------------------------------------------
TestTargetDrive:
// put something else which will test the boot drive's writability
return;
//-----------------------------------------------------------------------------
//
// Name: FileTransfer
//
// Descrip: This procedure will handle the file transfer for this
// installation.
//
// Params:
//
//-----------------------------------------------------------------------------
FileTransfer:
return;
//////////////////////////////////////////////////////////////////
//
// QuickTimeInstall
//
// Ask the user if we can install the required QTW files.
// If he is agreeable install it
//----------------------------------------------------------------
QuickTimeInstall:
szText = "Vampire's Kiss requires QuickTime v1.1.1 to run properly." +
" Click YES to install QuickTime v1.1.1 and add its path to your" +
" AUTOEXEC.BAT file.";
AskYesNo(szText, YES);
if LAST_RESULT = YES then
call CopyQuickTime;
else
szText = "Warning: You will need QuickTime v1.1.1 installed to properly" +
" run Vampire's Kiss.";
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "QuickTime Reminder!" );
MessageBox( szText, WARNING );
endif;
return;
//////////////////////////////////////////////////////////////////
//
// finishInstall
//
//
//----------------------------------------------------------------
finishInstall:
// Put the .ICO into the Windows directory //
StrCopy( TARGETDIR, WINDIR);
StatusUpdate( ON, 100);
SetStatusWindow( 99, "Copying file ... vampire.ICO" );
CopyFile( "vampire.ICO", "vampire.ICO" );
if LAST_RESULT < 0 then
StrCopy( szErrFile, "vampire.ICO" );
call CopyError;
endif;
// This creates a Windows Program Group
CreateProgGroup( "Digital Playground" );
szProgramPath = SRCDIR ^ "vampire.EXE";
szIconPath = WINDIR ^ "vampire.ICO";
if ( QueryProgItem( "Digital Playground", "Vampire's Kiss", szA, szB, szC, nvD, szE, nvF ) = 0 ) then
ParsePath( szWorkingDir, szProgramPath, PATH);
ReplaceProgItem( "Digital Playground", "Vampire's Kiss", "Vampire's Kiss", szProgramPath, szWorkingDir, szIconPath, 0, "", RUN_MINIMIZED);
else
AddProgItem( "Digital Playground", "Vampire's Kiss", szProgramPath, szIconPath);
endif;
szProgramPath = SRCDIR ^ "README.WRI";
if ( QueryProgItem( "Digital Playground", "Vampire's Kiss Read Me", szA, szB, szC, nvD, szE, nvF ) = 0 ) then
ParsePath( szWorkingDir, szProgramPath, PATH);
ReplaceProgItem( "Digital Playground", "Vampire's Kiss Read Me", "Vampire's Kiss Read Me", szProgramPath, szWorkingDir, "", 0, "", RUN_MINIMIZED);
else
AddProgItem( "Digital Playground", "Vampire's Kiss Read Me", szProgramPath, "");
endif;
StatusSetPercent( STATUS, 100 );// Installation is done
Disable( STATUS );
return;
//////////////////////////////////////////////////////////////////
//
// CopyQuickTime:
//
// Install the required QTW files.
//
//----------------------------------------------------------------
//----------------------------------------------------------------
CopyQuickTime:
// QuickTime for Windows needs to be installed
StatusUpdate( ON, 8);
SetStatusWindow( 7, "Searching for QuickTime for Windows..." );
GetDisk(WINDIR, szDisk);
StrCopy(szQTWPath, szDisk);
StrConcat(szQTWPath, "\\QTW");
// first check for any existing QTIM.DLL files on TargetDrive
QTWlist = ListCreate( STRINGLIST );
nResult = FindAllFiles( szDisk, "QTIM.DLL", szFileName, RESET );
while ( nResult = 0 )
ParsePath( szText2, szFileName, PATH );
// add each found path for QuickTime to the list
ListAddString( QTWlist, szText2, AFTER );
nResult = FindAllFiles( szDisk, "QTIM.DLL", szFileName, CONTINUE );
endwhile;
// if we found any releases of QuickTime, display the locations
if (ListCount( QTWlist ) > 0 ) then
szText = "The QuickTime for Windows software was\n" +
"found in the following location(s):\n";
nResult = ListGetFirstString( QTWlist, szText2 );
while (nResult = 0 )
szText = szText + szText2 + "\n";
nResult = ListGetNextString( QTWlist, szText2 );
endwhile;
szText = szText + "\nYou may wish to remove these files" +
" from your system if they are not in use.";
SetDialogTitle( DLG_MSG_INFORMATION, "QuickTime for Windows Found" );
MessageBox( szText, INFORMATION );
endif;
ListDestroy( QTWlist );
// Check to see if Directory Exists
ExistsDir(szQTWPath);
if LAST_RESULT = EXISTS goto QTWDirExists;
CreateDir(szQTWPath);
if LAST_RESULT = EXISTS goto QTWDirExists;
szText = "Cannot create QuickTime directory." +
" - Aborting installation.";
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;
QTWDirExists:
// Check to see if QTIM.DLL exists in the QuickTime
// directory. If it doesn't, then install QuickTime.
StrCopy( szText, szQTWPath );
AppendToPath( szText, "QTIM.DLL" );
GetFileInfo( szText, FILE_DATE, nNumber, szText2 );
// The directory is empty, so we will install our version.
if LAST_RESULT != FALSE then
// Copy the files to szQTWPath
StrCopy(TARGETDIR, szQTWPath);
StatusUpdate( ON, 96);
SetStatusWindow( 9, "Decompressing QuickTime files ..." );
DeCompress( "QTIME.LI$", "" );
if LAST_RESULT < 0 then
StrCopy( szErrFile, "QTIME.LI$" );
call CopyError;
endif;
else
// QuickTime is installed already.
// Which version is it?
if szText2 < "1994/01/11" then
szText2 = "An older";
elseif szText2 > "1994/01/11" then
szText2 = "A newer";
else
szText2 = "The same";
endif;
szText = szText2 + " version of QuickTime" +
" is already installed in the \\QTW directory," +
" so I will not install version 1.1.1 of QuickTime.\n\n" +
" If you wish to install version 1.1.1, you must erase" +
" the files found in the \\QTW directory, then re-run" +
" the Vampire's Kiss installer.";
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "QuickTime Already Installed!" );
MessageBox( szText, WARNING );
endif;
StrCopy(TARGETDIR, WINDIR);
StatusUpdate( ON, 100);
SetStatusWindow( 96, "Copying file ... QTW.INI");
CopyFile( "QTW.INI", "QTW.INI" );
if LAST_RESULT < 0 then
StrCopy(szErrFile, "QTW.INI" );
call CopyError;
endif;
// Now install things in the user specified directory
StrCopy( TARGETDIR, szDefPath );
// Now back up the user's AUTOEXEC.BAT file to AUTOEXEC.OLD
BatchGetFileName( szText );
GetDisk( szText, szText2 );
StrConcat( szText2, "\\AUTOEXEC.OLD" );
BatchFileLoad( szText );
BatchFileSave( "AUTOEXEC.OLD" );
szText = "Your AUTOEXEC.BAT file has been backed up to " +
INFOFILENAME + " and a new AUTOEXEC.BAT has been created.";
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_INFORMATION, "AUTOEXEC.BAT Modification Note" );
MessageBox( szText, INFORMATION );
// Add QuickTime path to the AUTOEXEC.BAT file
// EzBatchAddPath("PATH", SRCDIR, "", BEFORE);
EzBatchAddPath("PATH", szQTWPath, "", BEFORE);
//--end of QuickTime installation section
return;
//-----------------------------------------------------------------------------
//
// Name: PrefsMaker
//
// Descrip: This procedure will create the LINGO.INI file
//
// Params:
//
//-----------------------------------------------------------------------------
PrefsMaker:
return;
//-----------------------------------------------------------------------------
//
// Name: ConfirmCancel
//
// Descrip: This will as the users if they want to terminate the
// installation.
//
// Params:
//
//-----------------------------------------------------------------------------
ConfirmCancel:
AskYesNo( "Are you sure you want to CANCEL installation ?", FALSE );
if LAST_RESULT = FALSE then return; endif;
StrCopy( szText, "Installation has been cancelled." );
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "Aborted Installation Warning!" );
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;
return;
//-----------------------------------------------------------------------------
//
// Name: CopyError
//
// Descrip: This will be invoked when an error occurs during a
// file transfer operation.
//
// Params: szErrFile
//
//-----------------------------------------------------------------------------
CopyError:
StrCopy( szErrMsg, "Unable to copy or decompress file: ");
StrConcat( szErrMsg, szErrFile);
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_SEVERE, "Problem Occurred!" );
MessageBox( szErrMsg, SEVERE );
return;
//-----------------------------------------------------------------------------
//
// Name: HandleExit
//
// Descrip: This will be invoked when the exit button is hit.
// Normally you would use the default option IS provides
// but this provides you the ability to perform
// cleanup operations. Here we are deleting the
// synchronizing file.
//
// Params:
//
//-----------------------------------------------------------------------------
HandleExit: // This will handle the exit button
AskYesNo( "Are you sure you want to exit?", FALSE );
if LAST_RESULT = NO then
return;
endif;
StrCopy( szText, "You may need to delete Vampire's Kiss " );
StrConcat( szText, "files which were installed into the " );
StrConcat( szText, szResultPath );
StrConcat( szText, " directory." );
MessageBeep( 0 );
SetDialogTitle( DLG_MSG_WARNING, "Aborted Installation Warning!" );
MessageBox( szText, WARNING );
StrCopy( TARGETDIR, SRCDIR );
DeleteFile( "sync.fil" );
exit;